﻿<%@ Page Title="Lar São José" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Parceiros.aspx.cs" Inherits="LarDosIdosos.Parceiros" %>
<%@ Register Assembly="LarDosIdosos" TagPrefix="asc" Namespace="LarDosIdosos" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="divPrincipal">
    <div class="divCentralizadora">
		<asp:UpdatePanel ID="updatePanelParceiro" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
            <ContentTemplate>
		        <asp:Panel ID="panelParceiros" runat="server" >
		            	<div class="buttonCad">
		                    <asp:Button ID="buttonCadastrar" runat="server" OnClick="buttonCadastrar_OnClick" Text="Cadastrar"/>
						</div>
						<div class="divConsulta">
		                    <asp:TextBox id="textBoxConsulta" runat="server" Text=""></asp:TextBox><asp:ImageButton ID="imageButtonConsulta" ImageUrl="~/Imagens/lupaVisualizarRegistro.png" Width="20px" runat="server" OnClick="buttonConsulta_OnClick"/>
						</div>
		               <asc:GridViewCustom
		                ID="gridViewParceiros"
		                runat="server"
						Width="100%"
		                AutoGenerateColumns="False"
		                AllowSorting="True"
		                CssClass="tablestyle"
		                OnDataBound="gridViewParceiros_DataBound"
		                OnRowDataBound="gridViewParceiros_OnRowDataBound"
		                OnRowCommand="gridViewParceiros_OnRowCommand"
		                DataSourceID="dataSourceParceiros"
		                AllowPaging="True"
						BackColor="#E9E9E9"
						GridLines="None"
		                OnSorted="gridViewParceiros_OnSorted"
		                OnPageIndexChanged="gridViewParceiros_OnPageIndexChanged"
		                CellPadding="4">
		                <AlternatingRowStyle BackColor="#f7f7f7"/>
						<HeaderStyle BackColor="#EEEEEE" ForeColor="Black" />
						<RowStyle Height="50px" BackColor="#FFFFFF"/>
		                <EmptyDataRowStyle BackColor="#F7F7F7" Height="100px" VerticalAlign="Middle" HorizontalAlign="Center" />
		                <EmptyDataTemplate >
		                    Nenhum Resultado Encontrado
		                </EmptyDataTemplate>
		                <Columns>
		                    <asp:TemplateField HeaderStyle-Width="1%" ShowHeader="false">
							    <ItemTemplate>
		                            <asp:HiddenField ID="hiddenFieldId" runat="server" Value='<%# Eval("Codigo_Parceiro") %>' />
						        </ItemTemplate>
						    </asp:TemplateField>
		                    <asp:TemplateField HeaderText="Nome do Parceiro" SortExpression="Nome_Parceiro">
						        <ItemTemplate> 
						            <asp:Label ID="labelNomeDoParceiro" runat="server" Text='<%# Eval("Nome_Parceiro") %>' ></asp:Label>
						        </ItemTemplate>
						        <headerstyle Width="20%"/>
						    </asp:TemplateField>
		                    <asp:TemplateField HeaderText="Data de Nascimento" SortExpression="Data_De_Nascimento_Parceiro">
						        <ItemTemplate> 
						            <asp:Label ID="labelDataDeNascimento" runat="server" Text='<%# Eval("Data_De_Nascimento_Parceiro") %>' ></asp:Label>
						        </ItemTemplate>
						        <headerstyle Width="10%"/>
						    </asp:TemplateField>
		                    <asp:TemplateField HeaderText="CPF" SortExpression="CPF_Parceiro">
						        <ItemTemplate> 
						            <asp:Label ID="labelCpfDoParceiro" runat="server" Text='<%# Eval("CPF_Parceiro") %>' ></asp:Label>
						        </ItemTemplate>
						        <headerstyle Width="20%"/>
						    </asp:TemplateField>
		                    <asp:TemplateField HeaderText="RG" SortExpression="RG_Parceiro">
						        <ItemTemplate> 
						            <asp:Label ID="labelRgDoParceiro" runat="server" Text='<%# Eval("RG_Parceiro") %>' ></asp:Label>
						        </ItemTemplate>
						        <headerstyle Width="20%"/>
						    </asp:TemplateField>
		                    <asp:TemplateField HeaderText="Email" SortExpression="Email_Parceiro">
						        <ItemTemplate> 
						            <asp:Label ID="labelEmailDoParceiro" runat="server" Text='<%# Eval("Email_Parceiro") %>' ></asp:Label>
						        </ItemTemplate>
						        <headerstyle Width="10%"/>
						    </asp:TemplateField>
		                    <asp:TemplateField>
						        <ItemTemplate> 
						            <asp:ImageButton Visible="true" ID="imageButtonVisualizar" Runat="Server" ToolTip="Visualizar registro"  ImageUrl="~/Imagens/lupaVisualizarRegistro.png" CommandName="visualizar" CommandArgument='<%# ((GridViewRow) Container).RowIndex %>'/>	
		                            <asp:ImageButton Visible="false" ID="imageButtonEditar" Runat="Server" ToolTip="Editar registro"  ImageUrl="~/Imagens/lapisEditarRegistro.png"  CommandName="editar" CommandArgument='<%# ((GridViewRow) Container).RowIndex %>'/>	
		                            <asp:ImageButton Visible="false" ID="imageButtonExcluir" Runat="Server" ToolTip="Excluir registro"  ImageUrl="~/Imagens/ExcluirRegistro.png"  CommandName="excluir" CommandArgument='<%# ((GridViewRow) Container).RowIndex %>'/>				             
						        </ItemTemplate>
		                        <headerstyle Width="10%"/>
		                        <ItemStyle VerticalAlign ="Middle" HorizontalAlign="Center" />
		                    </asp:TemplateField>
		                </Columns>
		                <PagerTemplate>
		                    <table width="100%" >
		                        <tr>
		                            <td style="text-align:  left">
		                                Page Size: 
		                                <asp:DropDownList ID="ddPageSize" runat="server" EnableViewState="true" OnSelectedIndexChanged="ddPageSize_SelectedIndexChanged" AutoPostBack="true">
		                                    <asp:ListItem Text="10" ></asp:ListItem>
		                                    <asp:ListItem Text="15" ></asp:ListItem>
		                                    <asp:ListItem Text="20" ></asp:ListItem>
		                                    <asp:ListItem Text="25" ></asp:ListItem>
		                                    <asp:ListItem Text="30" ></asp:ListItem>
		                                    <asp:ListItem Text="35" ></asp:ListItem>
		                                    <asp:ListItem Text="40" ></asp:ListItem>
		                                    <asp:ListItem Text="45" ></asp:ListItem>
		                                    <asp:ListItem Text="50" ></asp:ListItem>
		                                </asp:DropDownList>
		                            </td>
		                            <td style="text-align: right">
		                                <asp:Label ID="lblPageCount" runat="server"></asp:Label>
		                            </td>
		                        </tr>
		                    </table>
		                </PagerTemplate>
		            </asc:GridViewCustom>
			        <div style="margin-top:5px">
			            <asp:DataPager  ID="pagerParceiros" PageSize="10" runat="server" PagedControlID="gridViewParceiros">
			                <Fields>                                            
			                    <asp:NextPreviousPagerField FirstPageText="&lt;&lt;" LastPageText="&gt;&gt;" 
			                        NextPageText="&gt;"  PreviousPageText="&lt;" ShowFirstPageButton="True"
			                        ShowNextPageButton="False" ButtonCssClass="datapager" />
			                    <asp:NumericPagerField ButtonCount="10"  NumericButtonCssClass="datapager" CurrentPageLabelCssClass="datapager"   />
			                    <asp:NextPreviousPagerField LastPageText="&gt;&gt;" NextPageText="&gt;" 
			                        ShowLastPageButton="True" ShowPreviousPageButton="False" ButtonCssClass="datapager" />
			                </Fields>
			            </asp:DataPager>
			        </div> 
		        </asp:Panel>
		        <br />
		        <asp:ObjectDataSource ID="dataSourceParceiros" runat="server" 
		            SelectMethod="BuscaParceiros" TypeName="LarDosIdosos.DataSources.DataSourceParceiros" 
		            EnablePaging="True" SelectCountMethod="TotalDeParceiros" 
		            SortParameterName="sortExpression">
		            <SelectParameters>
		                <asp:Parameter DefaultValue="select * from parceiro" Name="sql" Direction="Input" />
		            </SelectParameters>                                            
		        </asp:ObjectDataSource>
			
            </ContentTemplate>
		    <Triggers>
		        <asp:PostBackTrigger ControlID="buttonCadastrar" />
		        <asp:PostBackTrigger ControlID="gridViewParceiros"/>
		        <asp:PostBackTrigger ControlID="imageButtonConsulta"/>
		    </Triggers>
      	</asp:UpdatePanel>
    </div>
</div>
</asp:Content>
